<template>
  <view class="container">
    <pap-navbar bgColor="transparent" />
    <view class="title"> 请选择以下项目登录</view>
    <scroll-view scroll-y="true" class="grow min-h-0">
      <view class="TimUi-list">
        <view
          class="TimUi-list-item navigator-arrow"
          v-for="(item, index) in projectList"
          :key="index"
          @click="changeProject(item)"
        >
          <view class="TimUi-list-item-media">
            <u--image
              width="136rpx"
              height="136rpx"
              :showLoading="true"
              :src="item.logoIcoUrl"
            ></u--image>
          </view>
          <view class="TimUi-list-item-inner">
            <view class="TimUi-list-item-title"> {{ item.platformName }}</view>
            <!-- 先确认这里是不是展示单点登录平台上的remark字段 -->
            <view class="TimUi-list-item-text"> {{ item.remark || '-' }} </view>
          </view>
        </view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      projectList: []
    }
  },
  onShow() {
    this.projectList = uni.getStorageSync('SET_PLATFORMINFOS')
      ? JSON.parse(uni.getStorageSync('SET_PLATFORMINFOS'))
      : []
  },
  methods: {
    changeProject(item) {
      uni.setStorageSync('proxyUrl', item.appDomain)
      uni.redirectTo({
        url: '/pages/index/index'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  .title {
    padding: 32rpx 32rpx 40rpx;
    font-size: 40rpx;
    font-weight: 600;
    letter-spacing: 0.1em;
  }

  .TimUi-list {
    .TimUi-list-item {
      gap: 0 24rpx;
      margin: 32rpx;
      padding: 48rpx 44rpx;
      background: #ffffff;
      box-shadow: 0rpx 0rpx 60rpx 10rpx rgba(0, 0, 0, 0.08);
      border-radius: 8rpx;

      .TimUi-list-item-title {
        margin: 0 0 12rpx;
        font-size: 36rpx;
        font-weight: 500;
      }

      .TimUi-list-item-text {
        font-size: 28rpx;
        color: rgba(134, 144, 156, 1);
      }
    }
  }
}
</style>
